package io.kiki.sba.registry.server.metadata.provide.data;

import io.kiki.sba.registry.common.model.console.PersistenceData;
import io.kiki.sba.registry.common.model.constants.ValueConstants;
import io.kiki.sba.registry.server.shared.util.PersistenceDataParser;
import io.kiki.sba.registry.store.api.DBResponse;
import org.springframework.beans.factory.annotation.Autowired;


public class FetchStopPushService {

    @Autowired
    private ProvideDataService provideDataService;

    public boolean isStopPush() {
        DBResponse<PersistenceData> stopPushResp = provideDataService.queryProvideData(ValueConstants.STOP_PUSH_DATA_SWITCH_DATA_ID);
        return PersistenceDataParser.parse2BoolIgnoreCase(stopPushResp, false);
    }


    public FetchStopPushService setProvideDataService(ProvideDataService provideDataService) {
        this.provideDataService = provideDataService;
        return this;
    }
}
